import type { ResponseData } from '@libc/shared';

export class ApiResponse {
  static success<T = any>(data: T, message = 'success'): ResponseData {
    return {
      code: 200,
      message,
      data
    };
  }

  static success_page<T = any>(data: T, total: number, message = 'success'): ResponseData {
    return {
      code: 200,
      message,
      data,
      total
    };
  }

  static error(message = 'error', code = 500): ResponseData {
    return {
      code,
      message,
    };
  }

  static info(endpoints: Record<string, string>): ResponseData {
    return {
      code: 200,
      message: 'Koa server is running',
      data: {
        status: 'ok',
        timestamp: new Date().toISOString(),
        endpoints
      }
    };
  }
} 